package biznussoft.metercor.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import biznussoft.metercor.R;
import biznussoft.metercor.entity.ActivityModel;




public class ActivitesAdapter extends BaseAdapter {
	
	private ArrayList<ActivityModel> listdata;
	private Context mContext;

	public ActivitesAdapter(Context context, ArrayList<ActivityModel> list) {
		this.listdata = list;
		this.mContext = context;
	}

	public int getCount() {
		return listdata.size();
	}

	public Object getItem(int position) {
		return null;
	}

	public long getItemId(int position) {
		return 0;
	}
	
	public class ViewHolder{
		public TextView siteName;
		public TextView city;
		public TextView state;
	}

	public View getView(int position, View v, ViewGroup parent) {
		
		ViewHolder holder;
		if(v == null){
			holder = new ViewHolder();
			LayoutInflater inflator = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			v = inflator.inflate(R.layout.activity_display, null);
			holder.siteName  = (TextView) v.findViewById(R.id.text1);
			holder.city  = (TextView) v.findViewById(R.id.text2);
			v.setTag(holder);
		}else{
			holder = (ViewHolder) v.getTag();
		}
		
		ActivityModel bean = listdata.get(position);
		holder.siteName.setText(bean.getStep());
		holder.city.setText(bean.getActivityNameNew());
		return v;
	}

}
